package list;

public class LeetCode876 {
    public ListNode middleNode(ListNode head) {
        ListNode dummy = new ListNode(-1, head);
        ListNode fast = dummy.next;
        ListNode slow = dummy.next;
        while (fast != null && fast.next != null) {
            fast = fast.next.next;
            slow = slow.next;
        }
        return slow;
    }
}
